package com.qidian.permission.controller;

import com.qidian.permission.service.PermissionService;
import com.qidian.permission.util.PerResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 32郗建狄
 * @Company GX631
 * Time 2023/10/18 20:51
 * Description 这是一个controller
 */
@RestController
@RequestMapping("/permission")
@CrossOrigin
public class PermissionController {
    @Autowired
    PermissionService permissionService;

    @GetMapping("/list")
    public PerResult list(){
        return permissionService.selectAll();
    }
    @GetMapping("/queryByUserId")
    public PerResult queryByUserId(Long userId){
        return permissionService.queryByUserId(userId);
    }
    @GetMapping("/settingUserPermission")
    public PerResult settingUserPermission(Long userId,Long [] permissionId){
        return permissionService.settingUserPermission(userId, permissionId);
    }
}
